Extension

public interface Extension implements Advisable<P>

A Chrome extension.

Chrome extensions can be installed and uninstalled via the Extensions service. It is possible to install an extension from CRX files and Chrome Web Store. Each extension is installed on a per-profile basis, and is not shared with other profiles.

Extensions can be installed for incognito profiles. Extensions installed for the default profile in the engine with enableIncognito() option are also installed for the default profile. Extensions installed for the default profile in the engine without enableIncognito() option are not enabled when the engine is launched with this option.

The chrome.declarativeNetRequest API overlaps with JxBrowser network events and callbacks. If there is an extension that uses this API, it gets a chance to handle network requests first. Any changes made by the extension will be visible in the corresponding events and callbacks in JxBrowser. If the request is canceled by an extension, the network callbacks and events will not be invoked in JxBrowser for this request.

There are certain limitations related to Chromium tabs, windows, and other UI elements. The windows.Window is mapped to a native window associated with the browser, not the Java window it is embedded into (if any). Thus, methods and properties of the windows.Window object, such as Window.width, Window.height, Window.focused, etc., are bound to that native window.

From Chromium's perspective, each Browser is a window with one tab. Extensions that manipulate tabs, tab groups, or windows should be used with caution, as they might not work as expected.

Below is the list of Chromium Extension APIs that are not supported in JxBrowser:

  • chrome.tabs.discard.
  • chrome.tabs.move.
  • chrome.tabs.remove.
  • chrome.tabs.duplicate.
  • chrome.windows.remove.
  • chrome.windows.update.
  • chrome.window.create with more than one URL in parameters.
  • chrome.sessions.restore.
  • chrome.desktopCapture.chooseDesktopMedia.

If an extension calls an unsupported method that returns a Promise, it will be rejected with an error. If a method accepts a callback, the chrome.runtime.lastError property will be set to an error.

Since

8.0.0

Functions

Link copied to clipboard
public abstract Optional<ExtensionAction> action(Browser browser)
Returns the extension action for the given browser or an empty Optional if the extension does not have an action.
Link copied to clipboard
public abstract Extensions extensions()
Returns the Extensions service that manages this extension.
Link copied to clipboard
public abstract Optional<C> get<C extends P>(Class<C> callbackClass)
Returns an Optional that contains the callback of the given type or an empty Optional if there is no registered callback with the given type.
Link copied to clipboard
public abstract String id()
Returns the ID of this extension.
Link copied to clipboard
public abstract String name()
Returns the name of this extension.
Link copied to clipboard
public abstract C remove<C extends P>(Class<C> callbackClass)
Removes a particular service callback.
Link copied to clipboard
public abstract C set<C extends P>(Class<C> callbackClass, C callback)
Sets a particular service callback.
Link copied to clipboard
public abstract String version()
Returns the version of this extension.